(ns org.gridgain.plus.init.smart-func-init
    (:gen-class
        ; 生成 class 的类名
        :name org.gridgain.plus.init.SmartFuncInit
        ; 是否生成 class 的 main 方法
        :main false
        )
    (:require [clojure.string :as str]))

(defn func-smart-lower
    ([lst] (func-smart-lower lst #{}))
    ([[f & r] lst]
     (if (some? f)
         (recur r (conj lst (str/lower-case f)))
         lst)))

(defn func-smart-upper
    ([lst] (func-smart-upper lst #{}))
    ([[f & r] lst]
     (if (some? f)
         (recur r (conj lst (str/upper-case f)))
         lst)))

;(def func-smart #{"println" "first" "rest" "next" "second" "last" "query_sql" "noSqlCreate" "noSqlGet" "noSqlInsertTran" "noSqlUpdateTran" "noSqlDeleteTran"
;                  "noSqlDrop" "noSqlInsert" "noSqlUpdate" "noSqlDelete" "auto_id" "trans" "my_view" "rm_view" "add_scenes_to" "rm_scenes_from"
;                  "add_job" "remove_job" "job_snapshot" "add_func" "remove_func" "recovery_to_cluster" "create_train_matrix" "has_train_matrix"
;                  "drop_train_matrix" "train_matrix" "fit" "predict" "train_matrix_single" "loadCsv" "loadCode" "has_user_token_type" "get_user_group" "get_user_token"
;                  "add_user_group" "update_user_group" "delete_user_group"})

(def func-smart #{"rm_view"
                  "query_sql"
                  "fit"
                  "predict"
                  "next"
                  "remove_func"
                  "trans"
                  "second"
                  "delete_user_group"
                  "job_snapshot"
                  "add_func"
                  "recovery_to_cluster"
                  "auto_id"
                  "nosqlinsert"
                  "rest"
                  "has_train_matrix"
                  "nosqlupdate"
                  "println"
                  "add_scenes_to"
                  "get_user_token"
                  "rm_scenes_from"
                  "last"
                  "add_job"
                  "remove_job"
                  "has_user_token_type"
                  "create_train_matrix"
                  "nosqlget"
                  "my_view"
                  "nosqlcreate"
                  "nosqldrop"
                  "train_matrix_single"
                  "nosqlupdatetran"
                  "nosqldelete"
                  "drop_train_matrix"
                  "update_user_group"
                  "get_user_group"
                  "add_user_group"
                  "nosqldeletetran"
                  "loadcsv"
                  "nosqlinserttran"
                  "loadcode"
                  "first"
                  "train_matrix"})

;(def func-set #{"add" "set" "take" "drop" "nth" "concat" "concat_ws" "contains?" "put" "get" "remove" "pop" "peek"
;                "takeLast" "dropLast" "null?" "notNull?" "empty?" "notEmpty?" "nullOrEmpty?" "notNullOrEmpty?"
;                "str_replace" "str_split" "str_find" "format" "regular" "range" "length" "ucase" "day_name" "to_number"
;                "add_months" "to_date" "last_day" "trunc" "substr" "instrb" "chr" "months_between" "replace"
;                "substrb" "lengthb" "tolowercase" "lowercase" "toUpperCase" "uppercase" "show_msg"
;                "add_year" "add_quarter" "add_month" "add_date" "add_hour" "add_second" "add_ms"
;                "diff_year" "diff_quarter" "diff_month" "diff_date" "diff_hour" "diff_second" "diff_ms"
;                "show_cache_name"
;                })

(def func-set #{"add_month"
                "range"
                "peek"
                "diff_ms"
                "add_date"
                "show_cache_name"
                "takelast"
                "diff_date"
                "contains?"
                "chr"
                "lowercase"
                "notnull?"
                "diff_year"
                "put"
                "add_ms"
                "pop"
                "str_split"
                "add_hour"
                "str_find"
                "diff_second"
                "tolowercase"
                "nth"
                "add_year"
                "take"
                "lengthb"
                "instrb"
                "empty?"
                "add_second"
                "substrb"
                "last_day"
                "add_months"
                "to_date"
                "replace"
                "notempty?"
                "drop"
                "touppercase"
                "substr"
                "remove"
                "concat"
                "nullorempty?"
                "diff_quarter"
                "length"
                "trunc"
                "droplast"
                "regular"
                "ucase"
                "months_between"
                "day_name"
                "show_msg"
                "add"
                "str_replace"
                "null?"
                "set"
                "to_number"
                "notnullorempty?"
                "uppercase"
                "diff_month"
                "get"
                "add_quarter"
                "concat_ws"
                "diff_hour"
                "format"})

;(def db-func-set #{"avg" "count" "max" "min" "sum" "abs" "acos" "asin" "atan" "cos" "cosh" "cot" "sin" "sinh" "tan" "tanh" "atan2"
;                   "bitand" "bitget" "bitor" "bitxor" "mod" "pow" "sqrt"
;                   "ceiling" "degrees" "exp"
;                   "floor" "ln" "log" "log10" "pi" "radians" "round" "random_uuid" "roundMagic" "sign" "zero"
;                   "ascii" "char" "concat" "concat_ws" "instr" "lower" "upper" "left" "right" "locate" "position" "soundex" "space" "lpad" "rpad"
;                   "ltrim" "rtrim" "trim" "stringencode" "stringtoutf8" "to_char" "current_date" "current_time" "current_timestamp"
;                   "dayname"
;                   "day_of_month" "day_of_week" "day_of_year" "hour" "minute" "monthname" "quarter" "year" "month" "rand" "translate"
;                   "decode" "greatest" "least" "ifnull" "nullif" "nvl2"})

(def db-func-set #{"floor"
                   "day_of_week"
                   "space"
                   "cosh"
                   "min"
                   "trim"
                   "right"
                   "ascii"
                   "to_char"
                   "roundmagic"
                   "dayname"
                   "upper"
                   "translate"
                   "instr"
                   "lpad"
                   "atan2"
                   "cot"
                   "current_date"
                   "sum"
                   "rand"
                   "decode"
                   "max"
                   "day_of_year"
                   "nullif"
                   "bitxor"
                   "pow"
                   "degrees"
                   "stringtoutf8"
                   "zero"
                   "monthname"
                   "count"
                   "hour"
                   "atan"
                   "log"
                   "ln"
                   "least"
                   "greatest"
                   "bitor"
                   "position"
                   "sin"
                   "pi"
                   "rpad"
                   "radians"
                   "char"
                   "ltrim"
                   "nvl2"
                   "exp"
                   "ifnull"
                   "log10"
                   "current_timestamp"
                   "sqrt"
                   "concat"
                   "tan"
                   "cos"
                   "quarter"
                   "bitand"
                   "mod"
                   "bitget"
                   "avg"
                   "year"
                   "abs"
                   "lower"
                   "minute"
                   "current_time"
                   "soundex"
                   "day_of_month"
                   "month"
                   "random_uuid"
                   "ceiling"
                   "sinh"
                   "round"
                   "stringencode"
                   "asin"
                   "sign"
                   "rtrim"
                   "tanh"
                   "concat_ws"
                   "left"
                   "locate"
                   "acos"})

(def db-func-no-set #{"SECURE_RAND" "ENCRYPT" "DECRYPT" "TRUNCATE" "COMPRESS" "EXPAND" "BIT_LENGTH"
                      "LENGTH" "OCTET_LENGTH" "DIFFERENCE" "HEXTORAW" "RAWTOHEX" "REGEXP_REPLACE" "REGEXP_LIKE" "DATEADD" "DATEDIFF"
                      "EXTRACT" "FORMATDATETIME" "PARSEDATETIME" "CASEWHEN" "CAST" "CONVERT" "TABLE"})



